package cn.sofwin.os.service.impl;

import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import cn.sofwin.core.mvc.support.annotation.BaseDao;
import cn.sofwin.core.mvc.service.impl.BaseServiceImpl;
import cn.sofwin.core.mvc.support.bean.info.Module;
import cn.sofwin.os.entity.Goods;
import cn.sofwin.os.service.GoodsService;
import cn.sofwin.os.dao.GoodsDao;

/**
 * 商品服务层
 * @author LetCode
 * @version 1.0
 * @date 2020-04-23 11:28:34
 *
 */
@CacheConfig(cacheNames = "os_goods")
@Service("goodsService")
public class GoodsServiceImpl extends BaseServiceImpl<Goods> implements GoodsService {
	
	@BaseDao
	GoodsDao goodsDao;


	@Cacheable
	@Override
	public Module loadModuleInfo(){
		Module module = new Module("商品", "goods");

		// 增加表头字段信息
		module.addColumn("id", "序号")
		      .addColumn("title", "主标题")
		      .addColumn("subTitle", "副标题")
		      .addColumn("image", "封面图")
		      .addColumn("images", "缩略图")
		      .addColumn("price", "价格")
		      .addColumn("store", "库存")
		      .addColumn("content", "描述")
		      .addColumn("status", "状态：-1.删除，0.停用，1.正常");

		// 增加搜索字段信息
		module.addSearchField("title", "名称");

		// 增加视图地址
		module.addView("list", "/home/list/goods")
		      .addView("form", "/home/form/goods");

		// 增加数据请求接口
		module.addApi("base", "/os/goods");

		return module;
	}
}